package com.luojialong.utils;

import com.luojialong.enums.AffairStatus;
import com.luojialong.exception.AffairException;
import com.luojialong.resultVo.ResultResponse;

public class ResultUtils {

    public static<T> ResultResponse<T> success(T data) {
        return new ResultResponse<>(AffairStatus.SUCCESS,data);
    }


    public static ResultResponse failure(AffairStatus affairStatus) {
        return new ResultResponse<>(affairStatus);
    }


    public static ResultResponse failure(AffairStatus affairStatus,Exception ex) {
        return new ResultResponse(affairStatus,ex.getMessage());
    }



    public static ResultResponse failure(AffairException ex) {
        return new ResultResponse(ex.getAffairStatus(),ex.getDescription());
    }



}
